using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialStatisticsTools._MappingClusters
{
    /// <summary>
    /// <para>Spatial Outlier Detection</para>
    /// <para>Identifies spatial outliers in point features by calculating the local outlier factor (LOF) of each feature.  Spatial outliers are features in locations that are abnormally isolated, and the LOF is a measurement that describes how isolated a location is from its local neighbors. A higher LOF value indicates higher isolation. The tool can also be used to produce a raster prediction surface that can be used to estimate if new features will be classified as outliers given the spatial distribution of the data.</para>
    /// <para>通过计算每个要素的局部异常值因子 （LOF） 来识别点要素中的空间异常值。 空间异常值是异常隔离位置中的要素，LOF 是一种度量，用于描述位置与其本地邻居的隔离程度。LOF 值越高表示隔离度越高。该工具还可用于生成栅格预测表面，该表面可用于根据数据的空间分布来估计新要素是否被归类为异常值。</para>
    /// </summary>    
    [DisplayName("Spatial Outlier Detection")]
    public class SpatialOutlierDetection : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public SpatialOutlierDetection()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_features">
        /// <para>Input Features</para>
        /// <para>The point features used to build the spatial outlier detection model. Each point will be classified as an outlier or inlier based on its local outlier factor.</para>
        /// <para>用于构建空间异常值检测模型的点要素。每个点将根据其局部异常值因子被归类为异常值或非离群值。</para>
        /// </param>
        /// <param name="_output_features">
        /// <para>Output Features</para>
        /// <para>The output feature class containing the local outlier factor for each input feature as well as an indicator of whether the point is a spatial outlier.</para>
        /// <para>输出要素类，其中包含每个输入要素的局部异常值因子以及该点是否为空间异常值的指标。</para>
        /// </param>
        public SpatialOutlierDetection(object _in_features, object _output_features)
        {
            this._in_features = _in_features;
            this._output_features = _output_features;
        }
        public override string ToolboxName => "Spatial Statistics Tools";

        public override string ToolName => "Spatial Outlier Detection";

        public override string CallName => "stats.SpatialOutlierDetection";

        public override List<string> AcceptEnvironments => ["cellSize", "extent", "mask", "outputCoordinateSystem", "parallelProcessingFactor", "snapRaster"];

        public override object[] ParameterInfo => [_in_features, _output_features, _n_neighbors, _percent_outlier, _output_raster];

        /// <summary>
        /// <para>Input Features</para>
        /// <para>The point features used to build the spatial outlier detection model. Each point will be classified as an outlier or inlier based on its local outlier factor.</para>
        /// <para>用于构建空间异常值检测模型的点要素。每个点将根据其局部异常值因子被归类为异常值或非离群值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_features { get; set; }


        /// <summary>
        /// <para>Output Features</para>
        /// <para>The output feature class containing the local outlier factor for each input feature as well as an indicator of whether the point is a spatial outlier.</para>
        /// <para>输出要素类，其中包含每个输入要素的局部异常值因子以及该点是否为空间异常值的指标。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_features { get; set; }


        /// <summary>
        /// <para>Number of Neighbors</para>
        /// <para>The number of neighbors to include when calculating the local outlier factor. The closest features to the input point are used as neighbors. The default is 20.</para>
        /// <para>计算局部异常值因子时要包括的邻居数。最接近输入点的要素用作邻居。默认值为 20。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Neighbors")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _n_neighbors { get; set; } = 20;


        /// <summary>
        /// <para>Percent of Locations Considered Outliers</para>
        /// <para>The percent of locations to be identified as spatial outliers by defining the threshold of the local outlier factor. If no value is specified, a value is estimated at run time and is displayed as a geoprocessing message.</para>
        /// <para>通过定义局部异常值因子的阈值，要标识为空间异常值的位置的百分比。如果未指定任何值，则会在运行时估计一个值，并显示为地理处理消息。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Percent of Locations Considered Outliers")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double? _percent_outlier { get; set; } = null;


        /// <summary>
        /// <para>Output Prediction Raster</para>
        /// <para>The output raster containing the local outlier factors at each cell, which is calculated based on the spatial distribution of the input features.</para>
        /// <para>输出栅格包含每个像元处的局部异常值因子，该因子是根据输入要素的空间分布计算得出的。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Prediction Raster")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_raster { get; set; } = null;


        public SpatialOutlierDetection SetEnv(object cellSize = null, object extent = null, object mask = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object snapRaster = null)
        {
            base.SetEnv(cellSize: cellSize, extent: extent, mask: mask, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, snapRaster: snapRaster);
            return this;
        }

    }

}